"""
Author: Anthony Salgado
Date: December 7, 2011
"""

import re
import allperms
import sys

class Dictionary(object):
   
  def __init__(self):
    f = open('words.txt', 'r')
    self.words = re.findall('\w+',str(f.readlines()))
    self.__lookup = dict()
    for w in self.words:
      self.__lookup[w.lower()] = w.lower()
    
  def lookup(self, w):
    """
    calling lookup(w) searches the Dictionary for
    w. If it's a valid English word *according to
    txt/words.txt, then the method will return w
    """
    return self.__lookup.get(w)

  def __repr__(self):
    return str(self.__lookup)


 
    
